<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
<xs:schema id="Schema" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Migration" type="MigrationElement">
    <xs:key name="ProviderId">
      <xs:selector xpath="Providers/Provider" />
      <xs:field xpath="@id" />
    </xs:key>
    <xs:key name="ServerId">
      <xs:selector xpath="Servers/Tfs" />
      <xs:field xpath="@id" />
    </xs:key>
    <xs:key name="VCSessionId">
      <xs:selector xpath="VC/Sessions/Session" />
      <xs:field xpath="@id" />
    </xs:key>
    <xs:key name="WITSessionId">
      <xs:selector xpath="WIT/Sessions/Session" />
      <xs:field xpath="@id" />
    </xs:key>
  </xs:element>
  <!-- Non-empty string -->
  <xs:simpleType name="NonEmptyString">
    <xs:restriction base="xs:normalizedString">
      <xs:minLength value="1" />
    </xs:restriction>
  </xs:simpleType>
  <!-- VC Path -->
  <xs:simpleType name="VCPath">
    <xs:restriction base="xs:normalizedString">
      <xs:pattern value="[$](/[^$/][^/]*)+(/{0,1})" />
      <xs:pattern value="[$]/" />
    </xs:restriction>
  </xs:simpleType>
  <!-- Root element -->
  <xs:complexType name="MigrationElement">
    <xs:all>
      <xs:element name="Providers">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="Provider" type="ProviderElement" maxOccurs="unbounded" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="Servers">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="Tfs" type="ServerElement" maxOccurs="unbounded" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="Settings" type="SettingsElement" minOccurs="0">
        <xs:unique name="UniqueTopLevelSettingName">
          <xs:selector xpath="Setting" />
          <xs:field xpath="@name" />
        </xs:unique>
      </xs:element>
      <xs:element name="VC" type="VCElement" minOccurs="0" />
      <xs:element name="WIT" type="WITElement" minOccurs="0">
        <xs:key name="FieldMapName">
          <xs:selector xpath="FieldMaps/FieldMap"/>
          <xs:field xpath="@name"/>
        </xs:key>
        <xs:keyref name="FieldMapReference" refer="FieldMapName">
          <xs:selector xpath="Sessions/Session/WorkItemTypes/WorkItemType"/>
          <xs:field xpath="@fieldMap"/>
        </xs:keyref>
        <xs:key name="ValueMapName">
          <xs:selector xpath="ValueMaps/ValueMap"/>
          <xs:field xpath="@name"/>
        </xs:key>
      </xs:element>
      <xs:element name="Sql" minOccurs="1">
        <xs:complexType>
          <xs:all>
            <xs:element name="ConnectionString" type="xs:string" minOccurs="0"/>
            <xs:element name="Database" type="NonEmptyString" minOccurs="0"/>
            <xs:element name="Server" type="NonEmptyString" minOccurs="0"/>
          </xs:all>
        </xs:complexType>
      </xs:element>
    </xs:all>
  </xs:complexType>
  <!-- Collection of settings -->
  <xs:complexType name="SettingsElement">
    <xs:sequence>
      <xs:element name="Setting" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="name" type="xs:NCName" use="required" />
          <xs:attribute name="value" type="xs:normalizedString" use="required" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <!-- Element with an id -->
  <xs:complexType name="IdElement" abstract="true">
    <xs:attribute name="id" type="xs:NCName" use="required" />
  </xs:complexType>
  <!-- Provider definition -->
  <xs:complexType name="ProviderElement">
    <xs:complexContent>
      <xs:extension base="IdElement">
        <xs:sequence>
          <xs:element name="AssemblyQualifiedName" type="NonEmptyString" />
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <!-- Server definition -->
  <xs:complexType name="ServerElement">
    <xs:complexContent>
      <xs:extension base="IdElement">
        <xs:sequence>
          <xs:element name="Server" type="NonEmptyString" />
          <xs:element name="UseStoredCredentials" type="NonEmptyString" minOccurs="0" />
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <!-- VC-specific settings -->
  <xs:complexType name="VCElement">
    <xs:all>
      <xs:element name="Settings" type="SettingsElement" minOccurs="0">
        <xs:unique name="UniqueVCSettingName">
          <xs:selector xpath="Setting" />
          <xs:field xpath="@id" />
        </xs:unique>
      </xs:element>
      <xs:element name="Sessions">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="Session" type="VCSessionElement" minOccurs="1" maxOccurs="unbounded">
              <xs:keyref name="VCSessionProviderRef" refer="ProviderId">
                <xs:selector xpath="." />
                <xs:field xpath="@provider" />
              </xs:keyref>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:all>
  </xs:complexType>
  <!-- VC session -->
  <xs:complexType name="VCSessionElement">
    <xs:complexContent>
      <xs:extension base="IdElement">
        <xs:all>
          <xs:element name="Settings" type="SettingsElement" minOccurs="0">
            <xs:unique name="VCSessionSettingName">
              <xs:selector xpath="Setting" />
              <xs:field xpath="@name" />
            </xs:unique>
          </xs:element>
          <xs:element name="Mappings" minOccurs="0">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="Mapping" type="VCSessionMappingElement" minOccurs="0" maxOccurs="unbounded" />
              </xs:sequence>
            </xs:complexType>
            <xs:unique name="UniqueSrcCloak">
              <xs:selector xpath="Mapping" />
              <xs:field xpath="@src" />
              <xs:field xpath="@cloak" />
            </xs:unique>
            <xs:unique name="UniqueTgtCloak">
              <xs:selector xpath="Mapping" />
              <xs:field xpath="@tgt" />
              <xs:field xpath="@cloak" />
            </xs:unique>
            <xs:unique name="UniqueMapping">
              <xs:selector xpath="Mapping" />
              <xs:field xpath="@src" />
              <xs:field xpath="@tgt" />
            </xs:unique>
          </xs:element>
          <xs:element name="Tfs">
            <xs:complexType>
              <xs:complexContent>
                <xs:extension base="TfsServerReference">
                  <xs:sequence>
                    <xs:element name="Workspace" type="NonEmptyString" />
                    <xs:element name="WorkspaceRoot" type="NonEmptyString" />
                  </xs:sequence>
                </xs:extension>
              </xs:complexContent>
            </xs:complexType>
            <xs:keyref name="VCSessionTfsRef" refer="ServerId">
              <xs:selector xpath="." />
              <xs:field xpath="Server" />
            </xs:keyref>
          </xs:element>
          <xs:element name="Source">
            <xs:complexType mixed="true">
              <xs:sequence minOccurs="0" maxOccurs="unbounded">
                <xs:any processContents="skip" />
              </xs:sequence>
            </xs:complexType>
          </xs:element>
          <xs:element name="EventSinks" type="EventSinksElement" minOccurs="0"/>
        </xs:all>
        <xs:attribute name="provider" type="xs:NCName" />
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <!-- VC Session Mapping -->
  <xs:complexType name="VCSessionMappingElement">
    <xs:attribute name="src" type="NonEmptyString" use="required" />
    <xs:attribute name="tgt" type="VCPath" use="required" />
    <xs:attribute name="cloak" type="xs:boolean" use="optional" default="false" />
  </xs:complexType>
  <!-- Event sinks -->
  <xs:complexType name="EventSinksElement">
    <xs:sequence>
      <xs:element name="EventSink" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence minOccurs="0" maxOccurs="unbounded">
            <xs:any processContents="skip"/>
          </xs:sequence>
          <xs:attribute name="provider" type="xs:NCName" use="required"/>
        </xs:complexType>
        <xs:keyref name="EventSinkProviderIdRef" refer="ProviderId">
          <xs:selector xpath="."/>
          <xs:field xpath="@provider"/>
        </xs:keyref>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <!-- WIT-specific settings -->
  <xs:complexType name="WITElement">
    <xs:all>
      <xs:element name="Settings" type="SettingsElement" minOccurs="0">
        <xs:unique name="UniqueWITSettingName">
          <xs:selector xpath="Setting" />
          <xs:field xpath="@id" />
        </xs:unique>
      </xs:element>
      <xs:element name="Sessions">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="Session" type="WITSessionElement" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="FieldMaps" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="FieldMap" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:sequence minOccurs="0" maxOccurs="unbounded">
                  <xs:choice>
                    <xs:element name="Field">
                      <xs:complexType>
                        <xs:attribute name="tfsName" type="FieldName" use="required"/>
                        <xs:attribute name="otherName" type="FieldName" use="required"/>
                        <xs:attribute name="valueMap" type="FieldName" use="optional"/>
                      </xs:complexType>
                      <xs:keyref name="ValueMapReference" refer="ValueMapName">
                        <xs:selector xpath="."/>
                        <xs:field xpath="@valueMap"/>
                      </xs:keyref>
                    </xs:element>
                    <xs:element name="Exclude">
                      <xs:complexType>
                        <xs:attribute name="system" type="System" use="required"/>
                        <xs:attribute name="field" type="FieldName" use="required"/>
                      </xs:complexType>
                    </xs:element>
                  </xs:choice>
                </xs:sequence>
                <xs:attribute name="name" type="xs:NCName"/>
              </xs:complexType>
              <!-- Constraint: a field can appear only once on TFS -->
              <xs:unique name="UniqueTfsFieldNameInMapping">
                <xs:selector xpath="Field"/>
                <xs:field xpath="@tfsName"/>
              </xs:unique>
              <!-- Constraint: a field can appear only once on non-TFS-->
              <xs:unique name="UniqueOtherFieldNameInMapping">
                <xs:selector xpath="Field"/>
                <xs:field xpath="@otherName"/>
              </xs:unique>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="ValueMaps" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="ValueMap" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:sequence minOccurs="0" maxOccurs="unbounded">
                  <xs:element name="Value">
                    <xs:complexType>
                      <xs:attribute name="tfs" type="xs:string" use="required"/>
                      <xs:attribute name="other" type="xs:string" use="required"/>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
                <xs:attribute name="name" type="xs:NCName"/>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:all>
  </xs:complexType>

  <!-- WIT session -->
  <xs:complexType name="WITSessionElement">
    <xs:complexContent>
      <xs:extension base="IdElement">
        <xs:all>
          <xs:element name="Settings" type="SettingsElement" minOccurs="0">
            <xs:unique name="WITSessionSettingName">
              <xs:selector xpath="Setting" />
              <xs:field xpath="@name" />
            </xs:unique>
          </xs:element>
          <xs:element name="Tfs" type="WitTfsServer">
            <xs:keyref name="WITSessionTfsRef" refer="ServerId">
              <xs:selector xpath="."/>
              <xs:field xpath="@server"/>
            </xs:keyref>
          </xs:element>
          <xs:element name="Source">
            <xs:complexType>
              <xs:choice>
                <xs:element name="Tfs" type="WitTfsServer">
                  <xs:keyref name="WITSessionProviderTfsRev" refer="ServerId">
                    <xs:selector xpath="."/>
                    <xs:field xpath="@server"/>
                  </xs:keyref>
                </xs:element>
                <xs:element name="Provider">
                  <xs:complexType>
                    <xs:complexContent>
                      <xs:extension base="ProviderReference">
                        <xs:all>
                          <xs:element name="WriteQueue" type="WriteQueueElement" minOccurs="0"/>
                          <xs:element name="InitializationData" minOccurs="0"/>
                        </xs:all>
                      </xs:extension>
                    </xs:complexContent>
                  </xs:complexType>
                  <xs:keyref name="WITSessionProviderRef" refer="ProviderId">
                    <xs:selector xpath="."/>
                    <xs:field xpath="@provider"/>
                  </xs:keyref>
                </xs:element>
              </xs:choice>
            </xs:complexType>
          </xs:element>
          <xs:element name="FastQueue" type="ReadQueueElement" minOccurs="0"/>
          <xs:element name="SlowQueue" type="ReadQueueElement" minOccurs="0"/>
          <xs:element name="WorkItemTypes" minOccurs="0">
            <xs:complexType>
              <xs:sequence minOccurs="0" maxOccurs="unbounded">
                <xs:element name="WorkItemType" type="WITFieldMappingElement"/>
              </xs:sequence>
            </xs:complexType>
          </xs:element>
          <xs:element name="Policies" type="WitPoliciesElement" minOccurs="0"/>
          <xs:element name="EventSinks" type="EventSinksElement" minOccurs="0"/>

          <xs:element name="Linking" type="WitLinkingElement" minOccurs="0">
            <xs:keyref name="WITLinkingProviderRef" refer="ProviderId">
              <xs:selector xpath="." />
              <xs:field xpath="@provider" />
            </xs:keyref>
          </xs:element>

        </xs:all>
        <xs:attribute name="ignoreRevisions" type="xs:boolean" use="optional" default="false"/>
        <xs:attribute name="sleepTime" type="xs:nonNegativeInteger" use="optional" default="60"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <!-- Read queue definition -->
  <xs:complexType name="ReadQueueElement">
    <!-- Number of threads listening to the queue -->
    <xs:attribute name="threadCount" type="xs:nonNegativeInteger" use="optional" default="2"/>
    <!-- Number of items in the queue that triggers processing -->
    <xs:attribute name="batchSize" type="xs:positiveInteger" use="optional" default="50"/>
  </xs:complexType>
  <!-- Write queue definition -->
  <xs:complexType name="WriteQueueElement">
    <xs:complexContent>
      <xs:extension base="ReadQueueElement">
        <xs:attribute name="batchSize" type="xs:positiveInteger" default="64"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="FieldName">
    <xs:restriction base="xs:normalizedString">
      <xs:minLength value="1"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="System">
    <xs:restriction base="xs:string">
      <xs:enumeration value="tfs"/>
      <xs:enumeration value="other"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- Session-scoped field mapping -->
  <xs:complexType name="WITFieldMappingElement">
    <xs:attribute name="tfs" type="NonEmptyString" use="required"/>
    <xs:attribute name="other" type="NonEmptyString" use="required"/>
    <xs:attribute name="fieldMap" type="NonEmptyString" use="optional"/>
  </xs:complexType>
  <!-- TFS server reference -->
  <xs:complexType name="TfsServerReference" abstract="true">
    <xs:attribute name="server" type="xs:NCName" use="required"/>
  </xs:complexType>
  <!-- Provider reference -->
  <xs:complexType name="ProviderReference" abstract="true">
    <xs:attribute name="provider" type="xs:NCName" use="required"/>
  </xs:complexType>
  <!-- TFS server description used inside WIT sessions -->
  <xs:complexType name="WitTfsServer">
    <xs:complexContent>
      <xs:extension base="TfsServerReference">
        <xs:all>
          <xs:element name="Project" type="NonEmptyString" minOccurs="1" />
          <xs:element name="Filter" type="NonEmptyString" minOccurs="0"/>
          <xs:element name="DefaultArea" type="xs:string" minOccurs="0"/>
          <xs:element name="DefaultIteration" type="xs:string" minOccurs="0"/>
          <xs:element name="WriteQueue" type="WriteQueueElement" minOccurs="0"/>
          <xs:element name="FileAttachments" type="FileAttachmentElement" minOccurs="0"/>
          <xs:element name="Links" type="LinkElement" minOccurs="0"/>
          <xs:element name="MetadataSynchronization" type="MetadataSynchronizationElement" minOccurs="0"/>
        </xs:all>
        <xs:attribute name="fieldForm" use="optional" default="Friendly">
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:enumeration value="Friendly"/>
              <xs:enumeration value="Reference"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <!-- TFS file attachment settings -->
  <xs:complexType name="FileAttachmentElement">
    <xs:attribute name="filesPerUpdate" type="xs:positiveInteger" default="10"/>
  </xs:complexType>
  <!-- TFS link settings -->
  <xs:complexType name="LinkElement">
    <xs:attribute name="linksPerUpdate" type="xs:positiveInteger" default="10"/>
  </xs:complexType>
  <!-- WIT policies -->
  <xs:complexType name="WitPoliciesElement">
    <xs:all>
      <xs:element name="MissingUser" type="WitMissingUserPolicy" minOccurs="0"/>
      <xs:element name="MissingArea" type="WitMissingNodePolicy" minOccurs="0"/>
      <xs:element name="MissingIteration" type="WitMissingNodePolicy" minOccurs="0"/>
      <xs:element name="FieldConflict" type="WitFieldConflictPolicy" minOccurs="0"/>
      <xs:element name="AttachmentsConflict" type="WitFileAttachmentPolicy" minOccurs="0"/>
      <xs:element name="LinksConflict" type="WitCollectionsPolicy" minOccurs="0"/>
    </xs:all>
    <xs:attribute name="master" type="System" use="optional" default="tfs"/>
  </xs:complexType>
  <!-- Master policy -->
  <xs:complexType name="WitMasterPolicy" abstract="true">
    <xs:attribute name="master" use="optional" default="default">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="default"/>
          <xs:enumeration value="tfs"/>
          <xs:enumeration value="other"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>
  <!-- Missing user policy for WIT -->
  <xs:complexType name="WitMissingUserPolicy">
    <xs:attribute name="reaction" use="optional" default="throw">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="throw"/>
          <xs:enumeration value="default"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="defaultUser" type="NonEmptyString" use="optional"/>
  </xs:complexType>
  <!-- Conflicts in fields -->
  <xs:complexType name="WitFieldConflictPolicy">
    <xs:complexContent>
      <xs:extension base="WitMasterPolicy">
        <xs:attribute name="reaction" use="optional" default="master">
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:enumeration value="throw"/>
              <xs:enumeration value="master"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <!-- Conflicts in collections -->
  <xs:complexType name="WitCollectionsPolicy">
    <xs:complexContent>
      <xs:extension base="WitMasterPolicy">
        <xs:attribute name="reaction" use="optional" default="union">
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:enumeration value="throw"/>
              <xs:enumeration value="master"/>
              <xs:enumeration value="union"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <!-- Collections policy for WIT File Attachemments -->
  <xs:complexType name="WitFileAttachmentPolicy">
    <xs:complexContent>
      <xs:extension base="WitCollectionsPolicy">
        <xs:attribute name="tempDir" use="optional" />
        <xs:attribute name="extraComparisonAttributes" use="optional" default="all">
          <xs:simpleType>
            <xs:list>
              <xs:simpleType>
                <xs:restriction base="xs:string">
                  <xs:enumeration value="all"/>
                  <xs:enumeration value="createTime"/>
                  <xs:enumeration value="lastWriteTime"/>
                </xs:restriction>
              </xs:simpleType>
            </xs:list>
          </xs:simpleType>
        </xs:attribute>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <!-- Missing node policy -->
  <xs:complexType name="WitMissingNodePolicy">
    <xs:attribute name="reaction" use="optional" default="create">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="throw"/>
          <xs:enumeration value="create"/>
          <xs:enumeration value="default"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>
  <!-- Metadata synchronization element for TFS 2 TFS synchronization -->
  <xs:complexType name="MetadataSynchronizationElement">
    <xs:all>
      <xs:element name="IgnoredTypes" type="NamesCollection" minOccurs="0">
        <xs:unique name="UniqueIgnoredTypeName">
          <xs:selector xpath="Name"/>
          <xs:field xpath="@value"/>
        </xs:unique>
      </xs:element>
      <xs:element name="IgnoredLists" type="NamesCollection" minOccurs="0">
        <xs:unique name="UniqueIgnoredListName">
          <xs:selector xpath="Name"/>
          <xs:field xpath="@value"/>
        </xs:unique>
      </xs:element>
    </xs:all>
    <xs:attribute name="types" use="optional" default="all">
      <xs:simpleType>
        <xs:list>
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:enumeration value="accounts"/>
              <xs:enumeration value="lists"/>
              <xs:enumeration value="types"/>
              <xs:enumeration value="all"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:list>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>
  <!-- Collection of names -->
  <xs:complexType name="NamesCollection">
    <xs:sequence>
      <xs:element name="Name" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="value" type="NonEmptyString" use="required"/>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <!-- Session reference -->
  <xs:complexType name="SessionReferenceElement">
    <xs:attribute name="session" type="xs:NCName" use="required"/>
  </xs:complexType>
  <!-- Abstract linking session -->
  <xs:complexType name="LinkSessionBase" abstract="true">
    <xs:sequence>
      <xs:element name="Engine">
        <xs:complexType>
          <xs:sequence>
            <xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="provider" type="xs:NCName" use="required"/>
        </xs:complexType>
        <xs:keyref name="LinkProviderReference" refer="ProviderId">
          <xs:selector xpath="."/>
          <xs:field xpath="@provider"/>
        </xs:keyref>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <!-- Work item tracking linking session -->
  <xs:complexType name="WitLinkingElement">
    <xs:complexContent>
      <xs:extension base="LinkSessionBase">
        <xs:sequence>
          <xs:element name="VersionControl" type="SessionReferenceElement" minOccurs="0">
            <xs:keyref name="VCSessionFromLinking" refer="VCSessionId">
              <xs:selector xpath="."/>
              <xs:field xpath="@session"/>
            </xs:keyref>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>
